/*
 * Copyright 2005-2007 Pulse Technologies. Tutti i diritti riservati.
 */

package org.obsidianrad.server.services.obj2db.hessian;

import java.io.Serializable;

import org.obsidianrad.utils.Utils;



/**
 * 
 * @author eliosh
 * @version $Rev: 4 $
 * @lastautorcommit $Author: eliosh $
 * @lastdatecommit $Date: 2009-10-31 12:37:28 +0100(sab, 31 ott 2009) $
 */
public class FiltererHessian implements Serializable {

	private static final long serialVersionUID = 4924338029546345549L;

	private CriteriaHessian[] oredCriteria;

	private String orderByClause;
	private String typeObject;

	@Deprecated
	public FiltererHessian() {
		oredCriteria = new CriteriaHessian[1];
	}

	public FiltererHessian(String _base){
		this.typeObject = _base;
		oredCriteria = new CriteriaHessian[1];
	}

	public void setOrderByClause(String orderByClause) {
		this.orderByClause = orderByClause;
	}

	public String getOrderByClause() {
		return orderByClause;
	}

	public CriteriaHessian[] getCriteria() {
		return oredCriteria;
	}

	public void setCriteria(CriteriaHessian[] criteria) {
		this.oredCriteria = criteria;
	}

	public String getTypeObject() {
		return typeObject;
	}

	public void setTypeObject(String typeObject) {
		this.typeObject = typeObject;
	}

	public void or(CriteriaHessian criteria) {
		oredCriteria[oredCriteria.length-1] = criteria;
		oredCriteria = (CriteriaHessian[]) Utils.resizeArray(oredCriteria, oredCriteria.length+1);
	}

	public CriteriaHessian createCriteria() {
		CriteriaHessian criteria = createCriteriaInternal();
		oredCriteria[oredCriteria.length-1] = criteria;
		oredCriteria = (CriteriaHessian[]) Utils.resizeArray(oredCriteria, oredCriteria.length+1);
		return criteria;
	}

	private CriteriaHessian createCriteriaInternal() {
		CriteriaHessian criteria = new CriteriaHessian();
		return criteria;
	}

	public void clear() {
		oredCriteria = new CriteriaHessian[1];
	}	

}
